import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  //基础路径
  base: './',

  // 插件集
  plugins: [
    vue(),
  ],

  // 设置路径别名
  resolve: {
    alias: {
      '@': '/src'
    }
  },


  // 启动服务配置
  server: {
    proxy: {
    },
  },

  // 样式处理
  css: {
    preprocessorOptions: {
      less: {
        modifyVars: {
          hack: `true; @import (reference) "${resolve('src/assets/styles/config.less')}";`,
        },
        javascriptEnabled: true,
        // additionalData:  `@import "${resolve(__dirname, 'src/assets/styles/base.less')}";`
      }
    }
  },

  // 生产环境打包配置
  build: {
    terserOptions: {
      compress: {
        drop_console: true,     //q去掉console
        drop_debugger: true,    //去掉debugger
      },
    },
  },
})

